//
//  MyMebermerController.m
//  GBKHOME
//
//  Created by XMYY-19 on 2017/9/5.
//
//个人中心

#import "MyMebermerController.h"
#import "Global1.h"
#import "ModfiyController.h"
#import "ChangePassWordViewController.h"
#import "XMYYSyetemSettingViewController.h"
#import "SceneSetViewController.h"

#import "PresentTransitionAnimated.h"
#import "DismissTransitionAnimated.h"

@interface MyMebermerController ()<UIViewControllerTransitioningDelegate>
@property (retain, nonatomic) IBOutlet UILabel *updatePwd;
@property (retain, nonatomic) IBOutlet UILabel *setting;
@property (retain, nonatomic) IBOutlet UILabel *changeUser;

@property (retain, nonatomic) IBOutlet NSLayoutConstraint *viewBottonConstan;

@property (retain, nonatomic) UIPercentDrivenInteractiveTransition *percentDrivenTransition;
@end

@implementation MyMebermerController

-(void)viewWillLayoutSubviews{
    if (IS_IPAD) {
        self.viewBottonConstan.constant = 300;
    }
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
    UIImage *image =[UIImage imageNamed:@"bg_pic"];
    self.view.layer.contents = (id)image.CGImage;
    self.view.backgroundColor =[UIColor colorWithPatternImage:[UIImage imageNamed:@"bg_pic"]];
    
    self.changeUser.textColor =[UIColor colorWithRGBColorByString:@"#dadfff"];
    self.changeUser.userInteractionEnabled = YES;
    UITapGestureRecognizer *labelTapGestureRecognizer = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside:)];
    [self.changeUser addGestureRecognizer:labelTapGestureRecognizer];
    
    self.setting.textColor =[UIColor colorWithRGBColorByString:@"#dadfff"];
    self.setting.userInteractionEnabled = YES;
    UITapGestureRecognizer *labelTapGestureRecognizer1 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside1:)];
    [self.setting addGestureRecognizer:labelTapGestureRecognizer1];
    
    self.updatePwd.textColor =[UIColor colorWithRGBColorByString:@"#dadfff"];
    self.updatePwd.userInteractionEnabled = YES;
    UITapGestureRecognizer *labelTapGestureRecognizer2 = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(labelTouchUpInside2:)];
    [self.updatePwd addGestureRecognizer:labelTapGestureRecognizer2];
    
}
-(void) labelTouchUpInside:(UITapGestureRecognizer *)recognizer{
    
    NSLog(@"切换用户");
    [self dismissViewControllerAnimated:YES completion:nil];

}

-(void) labelTouchUpInside1:(UITapGestureRecognizer *)recognizer{
    
    NSLog(@"设置");
//    NSString *nameError = NSLocalizedString(@"功能开发中", nil);
//    [iToast showTip:nameError gravity:iToastGravityCenter];
    
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"SceneSetStoryboard" bundle:nil];
    SceneSetViewController *vc = [storyboard instantiateViewControllerWithIdentifier:@"SceneSetViewController"];
    vc.transitioningDelegate = self;
    [self presentViewController:vc animated:YES completion:nil];
    
    
}

-(void) labelTouchUpInside2:(UITapGestureRecognizer *)recognizer{
    
    NSLog(@"修改密码");
    [self presentViewController:[ChangePassWordViewController new] animated:NO completion:nil];

}

#pragma Mark - UIViewControllerTransitioningDelegate
- (id<UIViewControllerAnimatedTransitioning>)animationControllerForPresentedController:(UIViewController *)presented presentingController:(UIViewController *)presenting sourceController:(UIViewController *)source{
    return [[PresentTransitionAnimated alloc] init];
}
- (nullable id <UIViewControllerAnimatedTransitioning>)animationControllerForDismissedController:(UIViewController *)dismissed {
    return [[DismissTransitionAnimated alloc] init];
}

- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForPresentation:(id<UIViewControllerAnimatedTransitioning>)animator{
    return _percentDrivenTransition;
}

- (id<UIViewControllerInteractiveTransitioning>)interactionControllerForDismissal:(id<UIViewControllerAnimatedTransitioning>)animator{
    return _percentDrivenTransition;
}

- (void)dealloc {
    [_changeUser release];
    [_setting release];
    [_updatePwd release];
    [_viewBottonConstan release];
    [super dealloc];
}
@end
